home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / extras / Direct3D / Tools / Maya25 / xfileTranslatorOpts.mel < prev    next >
Encoding:
Text File  |  2001-10-08  |  8.6 KB  |  285 lines

  1.  
  2. global proc int xfileTranslatorOpts (string $parent,
  3.                                      string $action,
  4.                                      string $initialSettings,
  5.                                      string $resultCallback)
  6. //
  7. //    Description:
  8. //        This script posts the xfile file translator options.
  9. //        The optionsString is of the form:
  10. //            varName1=value1;varName2=value2;...
  11. //
  12. //    Parameters:
  13. //        $parent    - the elf parent layout for this options layout. It is
  14. //                    always a scrollLayout.
  15. //        $action    - the action that is to be performed with this invokation
  16. //                    of this proc. Valid options are:
  17. //                        "query" - construct the options string and pass it
  18. //                                    to the resultCallback.
  19. //                        "post"    - post all the elf controls.
  20. //        $initialSettings - the current options string in effect at the
  21. //                           time this script is invoked.
  22. //        $resultCallback    -
  23. //                This is the proc to be called with the result string. 
  24. //                resultCallback ( string $optionsString )
  25. //
  26. //    Returns:
  27. //        1 if successfull.
  28. //        0 otherwise.
  29. //
  30. {
  31.     int        $intVal;
  32.     float    $floatVal;
  33.     int        $bResult;
  34.     string    $currentOptions;
  35.     string    $optionList[];
  36.     string    $optionBreakDown[];
  37.     int        $index;
  38.  
  39.  
  40.     if ($action == "post") {
  41.         setParent $parent;
  42.  
  43.         setUITemplate -pushTemplate DefaultTemplate;
  44.  
  45.         formLayout -e -vis true optionsBoxForm;
  46.         
  47.         columnLayout -adj true;
  48.  
  49.  
  50.             frameLayout
  51.                     -cll true
  52.                     -cl false
  53.                     -bv true
  54.                     -bs "out"
  55.                     -l "File Options"
  56.                     frmFileOptions;
  57.  
  58.                 columnLayout -adj true;
  59.  
  60.                     radioButtonGrp
  61.                             -l "File Format"
  62.                             -nrb 3
  63.                             -la3 "ascii" "binary" "compressed" 
  64.                             optFileFormat;
  65.  
  66.                     radioButtonGrp -e -sl 1 optFileFormat;
  67.  
  68.                     
  69.                 setParent ..;   // columnLayout
  70.  
  71.             setParent ..;   // frameLayout
  72.  
  73.             frameLayout
  74.                     -cll true
  75.                     -cl false
  76.                     -bv true
  77.                     -bs "out"
  78.                     -l "Modelling Options"
  79.                 frmModelOptions;
  80.  
  81.                 columnLayout -adj true;
  82.  
  83.                     radioButtonGrp
  84.                                -l      "Nurbs Surfaces"
  85.                                -nrb    2
  86.                                -la2    "tesselate" "bezier patches"
  87.                         optExportPatches;
  88.  
  89.                     radioButtonGrp -e -sl 1 optExportPatches;
  90.  
  91.                     checkBoxGrp
  92.                             -l "Texture Coordinates"
  93.                             -ncb 2
  94.                             -la2 "flip U" "flip V"
  95.                         chkFlipTextureCoordinates;
  96.                     checkBoxGrp -e -v1 0 -v2 0 chkFlipTextureCoordinates;
  97.  
  98.                     radioButtonGrp
  99.                                -l      "Texture Filepath"
  100.                                -nrb    2
  101.                                -la2    "include" "don't include"
  102.                         optRelativeTextureFilename;
  103.  
  104.                     radioButtonGrp -e -sl 2 optRelativeTextureFilename;
  105.  
  106.                 setParent ..;   // columnLayout
  107.   
  108.             setParent..;    // frameLayout
  109.  
  110.  
  111.             frameLayout
  112.                     -cll true
  113.                     -cl false
  114.                     -bv true
  115.                     -bs "out"
  116.                     -l "Animation Options"
  117.                 frmAnimOptions;
  118.  
  119.                 columnLayout -adj true;
  120.  
  121.                     checkBox
  122.                             -l  "Export Animation"
  123.                             -al left
  124.                             -cc xfileSetExportAnim
  125.                         chkExportAnim;
  126.                     checkBox -e -v 1 chkExportAnim;
  127.  
  128.                     
  129.                     radioButtonGrp
  130.                                -l      "Animation Mode"
  131.                                -nrb    2
  132.                                -la2    "key-frame" "per-frame"
  133.                             -cc     xfileSetAnimMode
  134.                         optAnimMode;
  135.  
  136.                     radioButtonGrp -e -sl 1 optAnimMode;
  137.  
  138.  
  139.                     radioButtonGrp
  140.                                -l "Exfile Animation For"
  141.                                -nrb 2
  142.                                -la2 "animated objects only" "all objects" 
  143.                         optAnimObjects;
  144.  
  145.                     radioButtonGrp -e -sl 1 optAnimObjects;
  146.                     radioButtonGrp -e -en 0 optAnimObjects;
  147.  
  148.  
  149.                     intSliderGrp 
  150.                             -l "Frame Step" 
  151.                             -f true 
  152.                             -min 1 
  153.                             -max 500 
  154.                         sldFrameStep;
  155.  
  156.                     intSliderGrp -e -v 1    sldFrameStep;
  157.                     intSliderGrp -e -en 0   sldFrameStep;
  158.  
  159.  
  160.                 setParent ..;   // rowLayout
  161.   
  162.             setParent..;    // frameLayout
  163.  
  164.         setParent ..;    // columnLayout
  165.  
  166.  
  167.         formLayout -e -vis true optionsBoxForm;
  168.  
  169.         setUITemplate -popTemplate;
  170.  
  171.  
  172.  
  173.         // ---------------------------------------------------
  174.         //
  175.         // End of the UI generation portion
  176.         //
  177.         // ---------------------------------------------------
  178.  
  179.         
  180.         // Now set to current settings.
  181.  
  182.         return 1;
  183.     }
  184.     else if ($action == "query") {
  185.  
  186.         if (`checkBox -q -v chkExportAnim` == 0) {
  187.             $currentOptions = $currentOptions + "exportAnimation=false;";
  188.         }
  189.         else { 
  190.             $currentOptions = $currentOptions + "exportAnimation=true;";
  191.  
  192.             if (`radioButtonGrp -q -sl optAnimMode` == 1) {
  193.                 $currentOptions = $currentOptions + "keyframeAnimation=true;";
  194.             }
  195.             else if (`radioButtonGrp -q -sl optAnimMode` == 2) {
  196.                 $currentOptions = $currentOptions + "keyframeAnimation=false;";
  197.     
  198.                 if (`radioButtonGrp -q -sl optAnimObjects` == 1) {
  199.                     $currentOptions = $currentOptions + "animateEverything=false;";
  200.                 }
  201.                 else if (`radioButtonGrp -q -sl optAnimObjects` == 2) {
  202.                     $currentOptions = $currentOptions + "animateEverything=true;";
  203.                 }
  204.  
  205.                 $currentOptions = $currentOptions + "frameStep=" + `intSliderGrp -q -v sldFrameStep` + ";";
  206.             }
  207.         }
  208.     
  209.  
  210.         if (`radioButtonGrp -q -sl optFileFormat` == 1) {
  211.             $currentOptions = $currentOptions + "fileFormat=text;";
  212.         } 
  213.         else if (`radioButtonGrp -q -sl optFileFormat` == 2) {
  214.             $currentOptions = $currentOptions + "fileFormat=binary;";
  215.         }
  216.         else if (`radioButtonGrp -q -sl optFileFormat` == 3) {
  217.             $currentOptions = $currentOptions + "fileFormat=compressed;";
  218.         } 
  219.  
  220.        
  221.         
  222.         if (`radioButtonGrp -q -sl optExportPatches` == 1) {
  223.             $currentOptions = $currentOptions + "exportPatches=false;";
  224.         } 
  225.         else if (`radioButtonGrp -q -sl optExportPatches` == 2) {
  226.             $currentOptions = $currentOptions + "exportPatches=true;";
  227.         } 
  228.             
  229.  
  230.         if (`checkBoxGrp -q -v1 chkFlipTextureCoordinates` == 1) {
  231.             $currentOptions = $currentOptions + "flipU=true;";
  232.         } 
  233.         else {
  234.             $currentOptions = $currentOptions + "flipU=false;";
  235.         }
  236.  
  237.         if (`checkBoxGrp -q -v2 chkFlipTextureCoordinates` == 1) {
  238.             $currentOptions = $currentOptions + "flipV=true;";
  239.         } 
  240.         else {
  241.             $currentOptions = $currentOptions + "flipV=false;";
  242.         }
  243.         
  244.         if (`radioButtonGrp -q -sl optRelativeTextureFilename` == 1) {
  245.             $currentOptions = $currentOptions + "relTexFilename=false;";
  246.         } 
  247.         else if (`radioButtonGrp -q -sl optRelativeTextureFilename` == 2) {
  248.             $currentOptions = $currentOptions + "relTexFilename=true;";
  249.         } 
  250.  
  251.   
  252.  
  253.         eval($resultCallback+" \""+$currentOptions+"\"");
  254.  
  255.         return 1;
  256.     }
  257.  
  258.     return 0;
  259. }
  260.  
  261.  
  262.  
  263.  
  264. global proc xfileSetAnimMode() {
  265.     if (`radioButtonGrp -q -sl optAnimMode` == 1)   {
  266.         radioButtonGrp  -e -en 0 optAnimObjects;
  267.         intSliderGrp    -e -en 0 sldFrameStep;
  268.     }
  269.     else if (`radioButtonGrp -q -sl optAnimMode` == 2) {
  270.         radioButtonGrp  -e -en 1 optAnimObjects;
  271.         intSliderGrp    -e -en 1 sldFrameStep;
  272.     }
  273. }
  274.  
  275. global proc xfileSetExportAnim() {
  276.     if (`checkBox -q -v chkExportAnim` == 0) {
  277.         radioButtonGrp  -e -en 0 optAnimMode;
  278.         radioButtonGrp  -e -en 0 optAnimObjects;
  279.         intSliderGrp    -e -en 0 sldFrameStep;
  280.     }
  281.     else if (`checkBox -q -v chkExportAnim` == 1) {
  282.         radioButtonGrp  -e -en 1 optAnimMode;
  283.         xfileSetAnimMode();
  284.     }
  285. }